<template>
  <div>
    <el-table :data="cutObj.records" style="width: 100%;height:200px;">
      <el-table-column prop="userName" label="用户名" width="300"/>
      <el-table-column prop="pwd" label="密码" width="300"/>
      <el-table-column prop="realName" label="真实姓名" width="200"/>
      <el-table-column fixed="right" label="操作" width="250">
        <template #default="scope">
          <el-button type="primary" @click="del(scope.row.id)">删除用户</el-button>
          <el-button type="primary" @click="update(scope.row.id)">修改权限</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
        v-model:page-size="cutObj.size"
        background
        :total="cutObj.total"
        @current-change="findByItem"
    />
    <div>
      <el-row>
        <el-col :span="5">用户名:<input type="text " v-model="findObj.userName" style="width: 80px"></el-col>
        <el-col :span="7">
          <el-button type="primary" @click="findByItem(1)">搜素</el-button>
        </el-col>
      </el-row>
    </div>
    <el-button type="primary" @click="add()">添加</el-button>
  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      cutObj:[],
      findObj:{}
    }
  },
  methods:{
    findByItem(pageNO) {
      this.findObj.pageNO = pageNO
      axios.get("/project/user/findByItem", {params: this.findObj}).then(resp => {
        this.cutObj = resp.data
      })
    }
  },
  created() {
    this.findByItem(1)
  }
}
</script>

<style scoped>

</style>